$(function() {
<<<<<<< HEAD
	function getLocalTime(nS) {
		return new Date(parseInt(nS)).toLocaleString().substr(0, 17)
	}

	//	console.log(getLocalTime(1502882060000));
	var openId = '';
	$(function() {
		var startPage = 1;

		$.ajax({
			type: "get",
			url: "/proxy/getUserAll",
			contentType: "application/json; charset=utf-8",
			data: {
				'startPage': startPage,
			},
			success: function(res) {
				console.log(res)
				var page = res.data.totalPage
				for(var i = 0; i < res.data.value.length; i++) {

					var str = '';
					str += '<tr>';
					str += '<td>' + res.data.value[i].id + '</td>';
					str += '<td>' + res.data.value[i].nickName + '</td>';
					str += '<td class="imss"><img src="' + res.data.value[i].headImgUrl + '"  title="' + res.data.value[i].openid + '"/></td>';
					str += '<td>' + res.data.value[i].parentId + '</td>';
					str += '<td>' + res.data.value[i].agentName + '</td>';
					str += '<td>' + res.data.value[i].money.toFixed(2) + '</td>';
					str += '<td>' + res.data.value[i].commMoney.toFixed(2) + '</td>';
					str += '<td>' + res.data.value[i].giftAdvertMoney.toFixed(2) + '</td>';
					str += '<td>' + getLocalTime(res.data.value[i].createTime).substring(9, length) + '</td>';
					str += '<td><a href="#" class="ti">踢球明细</a> &ensp; <a href="#" class="tuan">团队详情</a><br /><a href="#" class="xian">提现详情</a> &ensp; <a href="#" class="gao">广告金记录</a><br /><a href="#" class="yong">佣金明细</a></td>';
					str += '</tr>';

					$('.gridtable').append(str);
				}
				$(".tcdPageCode").createPage({
					pageCount: page,
					current: 1,
					backFn: function(p) {
						startPage = p;
					}
				});

				$('.tcdPageCode').on('click', function() {
					$('tbody').children('tr').hide();
					var startPage = $('.tcdPageCode >.current').html() - 0;
					$.ajax({
						type: "get",
						url:"/proxy/getUserAll",
						contentType: "application/json; charset=utf-8",
						data: {
							'startPage': startPage
						},
						success: function(res) {
							for(var i = 0; i < res.data.value.length; i++) {
								var str = '';
								str += '<tr>';
								str += '<td>' + res.data.value[i].id + '</td>';
								str += '<td>' + res.data.value[i].nickName + '</td>';
								str += '<td class="imss"><img src="' + res.data.value[i].headImgUrl + '"  title="' + res.data.value[i].openid + '"/></td>';
								str += '<td>' + res.data.value[i].parentId + '</td>';
								str += '<td>' + res.data.value[i].agentName + '</td>';
								str += '<td>' + res.data.value[i].money.toFixed(2) + '</td>';
								str += '<td>' + res.data.value[i].commMoney.toFixed(2) + '</td>';
								str += '<td>' + res.data.value[i].giftAdvertMoney.toFixed(2) + '</td>';
								str += '<td>' + getLocalTime(res.data.value[i].createTime).substring(9, length) + '</td>';
								str += '<td><a href="#" class="ti">踢球明细</a> &ensp; <a href="#" class="tuan">团队详情</a> &ensp; <a href="#" class="xian">提现详情</a> &ensp; <a href="#" class="gao">广告金记录</a> &ensp; <a href="#" class="yong">佣金明细</a></td>';
								str += '</tr>';

								$('tbody').append(str);
							}
						}
					});
				})

				function status(openId, inPage) {
					$.ajax({
						type: "get",
						url:"/proxy/getKickBallByOpenId",
						contentType: "application/json; charset=utf-8",
						data: {
							'openId': openId,
							'startPage': inPage
						},
						success: function(res) {
							if(res.error_code == 0) {
								//								var stt = '<ul class="topnav"><li>序号</li><li>踢球时间</li><li>中球金额</li><li>下注金额</li></ul>';
								//								$('.football').append(stt);
								for(var i = 0; i < res.data.value.length; i++) {
									var str = '';
									str += '<ul class="ziy">';
									str += '<li>' + ((res.data.inPage * 10 - 10) + i + 1) + '</li>';
									str += '<li>' + getLocalTime(res.data.value[i].kickballTime).substring(9, length) + '</li>';
									str += '<li>' + res.data.value[i].amountMoney + '</li>';
									str += '<li>' + res.data.value[i].betAmount + '</li>';
									$('.football').append(str)
								}
							} else {
								alert('该用户暂时没有踢球明细！');
							}
						}
					})
				}
				//踢球明细
				var openId = '';
				$('tbody').on('click', '.ti', function() {
					$('.football').show().siblings().hide();
					$('.football .nav-gta >h3').html($(this).html())
					$('.cover').show();
					$('.topnav').show();
					openId = $(this).parent().siblings('.imss').children().attr('title');
					status(openId, 1)

				});

				var j = 1;
				$('.reduce').on('click', function(event) {
					event.stopPropagation();

					if($('.football').find('.ziy').length >= 10) {
						j++;

						$('.football').children().remove('.topnav')
						$('.football').children().remove('.ziy')
						$('.cover').show();
						$('.topnav').show();
						status(openId, j)
					}
				})

				$('.plus').on('click', function(event) {
					event.stopPropagation();
					if($('.football').find('.ziy').first().children().first().html() - 10 >= 1) {
						j--;
						$('.football').children().remove('.topnav')
						$('.football').children().remove('.ziy')
						$('.cover').show();
						$('.topnav').show();
						status(openId, j)
					}

				})
				//------------------------
				//团队详情

				$('tbody').on("click", '.tuan', function() {
					$('.football-4').show().siblings().hide()
					$('.cover').show();
					var openId = $(this).parent().siblings(':first').html();
					$.ajax({
						type: "get",
						url:"/proxy/getProxyNum",
						contentType: "application/json; charset=utf-8",
						data: {
							'uid': openId
						},
						success: function(res) {
							if(res.error_code == 0) {
								$('.yyji').html(res.data.count1)
								$('.eeji').html(res.data.count2)
								$('.ssji').html(res.data.count3)
							} else {
								alert('该用户暂时没有团队详情！')
							}
						}
					});
				})

				function download(openId, startPage) {
					$.ajax({
						type: "get",
						url"/proxy/getCashRecord",
						contentType: "application/json; charset=utf-8",
						data: {
							'openId': openId,
							'startPage': startPage
						},
						success: function(res) {
							if(res.error_code == 0) {
								for(var i = 0; i < res.data.value.length; i++) {
									var str = '';
									str += '<ul class="ziy">';
									str += '<li>' + ((res.data.inPage * 10 - 10) + i + 1) + '</li>';
									str += '<li>' + getLocalTime(res.data.value[i].createTime).substring(9, length) + '</li>';
									str += '<li>' + res.data.value[i].money.toFixed(2) + '</li>';
									if(res.data.value[i].status == 0) {
										str += '<li>' + '成功' + '</li>';
									} else {
										str += '<li>' + '失败' + '</li>';
									}
									$('.football-2').append(str)
								}
							} else {
								alert('该用户暂时没有提现记录！！')
							}

						}
					});
				}
				//提现记录
				var openId = '';
				$('tbody').on('click', '.xian', function() {
					$('.football-2').children().remove('.ulas')
					$('.football-2').show().siblings().hide()
					$('.football-2 .nav-gta >h3').html($(this).html());
					$('.cover').show();
					openId = $(this).parent().siblings('.imss').children().attr('title');
					download(openId, 1);
				})
				var i = 1;
				$('.lower').on('click', function(event) {
					event.stopPropagation();
					if($('.football-2').find('.ziy').length >= 10) {
						$('.football-2').children().remove('.ziy')
						i++;
						download(openId, i);
					}

				})

				$('.upper').on('click', function(event) {
					event.stopPropagation();
					if($('.football-2').find('.ziy').first().children().first().html() - 10 >= 1) {
						i--;
						$('.football-2').children().remove('.ziy')
						download(openId, i);
					}
				})
				//----------------------

				var openId = '';
				$('tbody').on('click', '.gao', function() {
					$('.displays-2').children().remove('.guangao');
					$('.football-3').show().siblings().hide()
					$('.cover').show();
					$('.football-1').show();
					openId = $(this).parent().siblings('.imss').children().attr('title');
					charset(openId, 1)
				});
				var m = 1;
				$('.toim').on('click', function(event) {
					event.stopPropagation();
					if($('.displays-1').find('.guangao').length >= 10) {
						$('.displays-1').children().remove('.guangao');
						m++;
						charset(openId, m);
					}
				})

				$('.toggles').on('click', function(event) {
					event.stopPropagation();
					if($('.displays-1').find('.guangao').first().children().first().html() - 10 >= 1) {
						m--;
						$('.displays-1').children().remove('.guangao');
						charset(openId, m)
					}
				})

				function charset(openId, startPage) {
					$.ajax({
						type: "get",
						url:"/proxy/getRechargeRecordMoney",
						contentType: "application/json; charset=utf-8",
						data: {
							'openId': openId,
							'startPage': startPage
						},
						success: function(res) {
							if(res.error_code == 0) {
								var Advertise = 'Advertise';
								var footBall = 'footBall';
								//支出
								for(var i = 0; i < res.data.value.length; i++) {
									var str = '';
									str += '<ul class="guangao">';
									str += '<li>' + ((res.data.inPage * 10 - 10) + i + 1) + '</li>';
									str += '<li>' + getLocalTime(res.data.value[i].rechargeTime).substring(9, length) + '</li>';
									str += '<li>' + res.data.value[i].money.toFixed(2) + '</li>';
									str += '<li>成功</li>';
									str += '</ul>';

									$('.displays-1').append(str)
								}
							} else {
								alert('该用户暂时没有广告金记录！！')
							}
						}
					});
				}

				$('.spend').on('click', function(event) {
					$('.displays-2').children().remove('.guangao')
					event.stopPropagation();
					$('.displays-2').children().remove('.ulclass')
					$('.displays-1').hide();
					$('.displays-2').show();
					manager(openId, 1);
				})

				var n = 1;
				$('.Last').on('click', function(event) {
					event.stopPropagation();
					if($('.displays-2').find('.guangao').length >= 10) {
						$('.displays-2').children().remove('.guangao');
						n++;
						manager(openId, n);
					}
				})

				$('.fost').on('click', function(event) {
					event.stopPropagation();
					if($('.displays-2').find('.guangao').first().children().first().html() - 10 >= 1) {
						n--;
						if(n !== 0) {
							$('.displays-2').children().remove('.guangao');
							manager(openId, n);
						}
					}

				})

				function manager(openId, startPage) {
					$.ajax({
						type: "get",
						url:"/proxy/getExpendRecordMoney",
						contentType: "application/json; charset=utf-8",
						data: {
							'openId': openId,
							'startPage': startPage
						},
						success: function(res) {
							console.log(res);
							for(var i = 0; i < res.data.value.length; i++) {
								str = '';
								str += '<ul class="guangao">';
								str += '<li>' + ((res.data.inPage * 10 - 10) + i + 1) + '</li>';
								str += '<li>' + getLocalTime(res.data.value[i].expendTime).substring(9, length) + '</li>';
								str += '<li>' + res.data.value[i].expendMoney.toFixed(2) + '</li>';
								str += '<li>成功</li>';
								str += '</ul>';

								$('.displays-2').append(str)
							}
						}
					});
				}

				//佣金纪录
				function advertisement(openId, startPage) {
					$.ajax({
						type: "get",
						url:"/proxy/getCommRecord",
						contentType: "application/json; charset=utf-8",
						data: {
							'openId': openId,
							'startPage': startPage
						},
						success: function(res) {
							if(res.error_code == 0) {
								var commType = "advertClick";
								var agencyComm = 'agencyComm';
								for(var i = 0; i < res.data.value.length; i++) {
									var str = '';
									str += '<ul class="ziy">';
									str += '<li>' + ((res.data.inPage * 10 - 10) + i + 1) + '</li>';
									str += '<li>' + getLocalTime(res.data.value[i].commTime).substring(9, length) + '</li>';
									str += '<li>' + res.data.value[i].money.toFixed(2) + '</li>';
									if(res.data.value[i].commType == commType) {
										str += '<li>点击广告</li>';
									} else if(res.data.value[i].commType == agencyComm) {
										str += '<li>返佣</li>';
									}
									$('.football-3').append(str)
								}
							} else {
								alert('该用户暂时没有佣金提现记录！')
							}
						}
					});
				}

				var openId = '';
				$('tbody').on('click', '.yong', function() {
					$('.football-3').children().remove('.ziy')
					$('.football-3').show().siblings().hide()
					$('.cover').show();
					openId = $(this).parent().siblings('.imss').children().attr('title');
					advertisement(openId, 1)
				})

				var a = 1;
				$('.goto').on('click', function(event) {
					event.stopPropagation();
					if($('.football-3').find('.ziy').length >= 10) {
						$('.football-3').children().remove('.ziy')
						a++;
						advertisement(openId, a)
					}
				})

				$('.come').on('click', function(event) {
					event.stopPropagation();
					if($('.football-3').find('.ziy').first().children().first().html() - 10 >= 1) {
						$('.football-3').children().remove('.ziy')
						a--;
						advertisement(openId, a)
					}

				})
			}
		});

		$('.cover').on('click', function() {
			$('.cover').hide();
			$('.football').children().remove('.ziy')
			$('.football').children().remove('.yiji')
			$('.football').children().remove('.yingc1')
			$('.football').children().remove('.topnav')
			$('.football-2').children().remove('.ziy')

			$('.displays-1').children().remove('.guangao')
			$('.displays-2').children().remove('.guangao')
		})

		$('.but-input').on('click', function() {
			var input_val = $('.query-input').val();
			if(input_val.length !== 0) {
				$('.Tbody').children('tr').remove();
				$.ajax({
					type: "get",
					url: "/proxy/checkUserById",
					contentType: "application/json; charset=utf-8",
					data: {
						'uid': input_val
					},
					success: function(res) {
						console.log(res)
						if(res.data.id == input_val) {
							var str = '';
							str += '<tr>';
							str += '<td>' + res.data.id + '</td>';
							str += '<td>' + res.data.nickName + '</td>';
							str += '<td class="imss"><img src="' + res.data.headImgUrl + '"  title="' + res.data.openid + '"/></td>';
							str += '<td>' + res.data.parentId + '</td>';
							str += '<td>' + res.data.agentName + '</td>';
							str += '<td>' + res.data.money.toFixed(2) + '</td>';
							str += '<td>' + res.data.commMoney.toFixed(2) + '</td>';
							str += '<td>' + res.data.giftAdvertMoney.toFixed(2) + '</td>';
							str += '<td>' + getLocalTime(res.data.createTime).substring(9, length) + '</td>';
							str += '<td><a href="#" class="ti">踢球明细</a> &ensp; <a href="#" class="tuan">团队详情</a> &ensp; <a href="#" class="xian">提现详情</a> &ensp; <a href="#" class="gao">广告金记录</a> &ensp; <a href="#" class="yong">佣金明细</a></td>';
							str += '</tr>';

							$('.Tbody').append(str)
							$('.post').siblings().hide();
						} else if(res.data.id == null) {
							alert(res.id)
						}
						$(".tcdPageCode").createPage({
							pageCount: 1,
							current: 1,
							backFn: function(p) {
								startPage = p;
							}
						});
					}
				});

			}
		})

		$('.Page').on('click', function(event) {
			event.stopPropagation();
		})

		$('.record').on('click', function() {
			$(this).css('background', 'lightgrey').siblings().css('background', '#eee')
		})

		$('.recharge').on('click', function(event) {
			event.stopPropagation();
			$('.displays-1').show();
			$('.displays-2').hide();
		})
		$('.nextPage').on('click', function(event) {
			return false;
		})
	})
=======
    function getLocalTime(nS) {
        return new Date(parseInt(nS)).toLocaleString().substr(0, 17)
    }

    //	console.log(getLocalTime(1502882060000));
    var openId = '';
    $(function() {
        var startPage = 1;

        $.ajax({
            type: "get",
            url: "/proxy/getUserAll",
            contentType: "application/json; charset=utf-8",
            data: {
                'startPage': startPage,
            },
            success: function(res) {
                console.log(res)

                for(var i = 0; i < res.data.value.length; i++) {
                    var page = res.data.totalPage
                    var str = '';
                    str += '<tr>';
                    str += '<td>' + res.data.value[i].id + '</td>';
                    str += '<td>' + res.data.value[i].nickName + '</td>';
                    str += '<td class="imss"><img src="' + res.data.value[i].headImgUrl + '"  title="' + res.data.value[i].openid + '"/></td>';
                    str += '<td>' + res.data.value[i].parentId + '</td>';
                    str += '<td>' + res.data.value[i].agentName + '</td>';
                    str += '<td>' + res.data.value[i].money.toFixed(2) + '</td>';
                    str += '<td>' + res.data.value[i].commMoney.toFixed(2) + '</td>';
                    str += '<td>' + res.data.value[i].giftAdvertMoney.toFixed(2) + '</td>';
                    str += '<td>' + getLocalTime(res.data.value[i].createTime).substring(9, length) + '</td>';
                    str += '<td><a href="#" class="ti">踢球明细</a> &ensp; <a href="#" class="tuan">团队详情</a><br /><a href="#" class="xian">提现详情</a> &ensp; <a href="#" class="gao">广告金记录</a><br /><a href="#" class="yong">佣金明细</a></td>';
                    str += '</tr>';

                    $('.gridtable').append(str);
                }
                $(".tcdPageCode").createPage({
                    pageCount: page,
                    current: 1,
                    backFn: function(p) {
                        startPage = p;
                    }
                });

                $('.tcdPageCode').on('click', function() {
                    $('tbody').children('tr').hide();
                    var startPage = $('.tcdPageCode >.current').html() - 0;
                    $.ajax({
                        type: "get",
                        url: "/proxy/getUserAll",
                        contentType: "application/json; charset=utf-8",
                        data: {
                            'startPage': startPage
                        },
                        success: function(res) {
                            for(var i = 0; i < res.data.value.length; i++) {
                                var str = '';
                                str += '<tr>';
                                str += '<td>' + res.data.value[i].id + '</td>';
                                str += '<td>' + res.data.value[i].nickName + '</td>';
                                str += '<td class="imss"><img src="' + res.data.value[i].headImgUrl + '"  title="' + res.data.value[i].openid + '"/></td>';
                                str += '<td>' + res.data.value[i].parentId + '</td>';
                                str += '<td>' + res.data.value[i].agentName + '</td>';
                                str += '<td>' + res.data.value[i].money.toFixed(2) + '</td>';
                                str += '<td>' + res.data.value[i].commMoney.toFixed(2) + '</td>';
                                str += '<td>' + res.data.value[i].giftAdvertMoney.toFixed(2) + '</td>';
                                str += '<td>' + getLocalTime(res.data.value[i].createTime).substring(9, length) + '</td>';
                                str += '<td><a href="#" class="ti">踢球明细</a> &ensp; <a href="#" class="tuan">团队详情</a> &ensp; <a href="#" class="xian">提现详情</a> &ensp; <a href="#" class="gao">广告金记录</a> &ensp; <a href="#" class="yong">佣金明细</a></td>';
                                str += '</tr>';

                                $('tbody').append(str);
                            }
                        }
                    });
                })

                function status(openId, inPage) {
                    $.ajax({
                        type: "get",
                        url: "/proxy/getKickBallByOpenId",
                        contentType: "application/json; charset=utf-8",
                        data: {
                            'openId': openId,
                            'startPage': inPage
                        },
                        success: function(res) {
                            if(res.error_code == 0) {
                                //								var stt = '<ul class="topnav"><li>序号</li><li>踢球时间</li><li>中球金额</li><li>下注金额</li></ul>';
                                //								$('.football').append(stt);
                                for(var i = 0; i < res.data.value.length; i++) {
                                    var str = '';
                                    str += '<ul class="ziy">';
                                    str += '<li>' + ((res.data.inPage * 10 - 10) + i + 1) + '</li>';
                                    str += '<li>' + getLocalTime(res.data.value[i].kickballTime).substring(9, length) + '</li>';
                                    str += '<li>' + res.data.value[i].amountMoney + '</li>';
                                    str += '<li>' + res.data.value[i].betAmount + '</li>';
                                    $('.football').append(str)
                                }
                            } else {
                                alert('该用户暂时没有踢球明细！');
                            }
                        }
                    })
                }
                //踢球明细
                var openId = '';
                $('tbody').on('click', '.ti', function() {
                    $('.football').show().siblings().hide();
                    $('.football .nav-gta >h3').html($(this).html())
                    $('.cover').show();
                    $('.topnav').show();
                    openId = $(this).parent().siblings('.imss').children().attr('title');
                    status(openId, 1)

                });

                var j = 1;
                $('.reduce').on('click', function(event) {
                    event.stopPropagation();

                    if($('.football').find('.ziy').length >= 10) {
                        j++;

                        $('.football').children().remove('.topnav')
                        $('.football').children().remove('.ziy')
                        $('.cover').show();
                        $('.topnav').show();
                        status(openId, j)
                    }
                })

                $('.plus').on('click', function(event) {
                    event.stopPropagation();
                    if($('.football').find('.ziy').first().children().first().html() - 10 >= 1) {
                        j--;
                        $('.football').children().remove('.topnav')
                        $('.football').children().remove('.ziy')
                        $('.cover').show();
                        $('.topnav').show();
                        status(openId, j)
                    }

                })
                //------------------------
                //团队详情

                $('tbody').on("click", '.tuan', function() {
                    $('.football-4').show().siblings().hide()
                    $('.cover').show();
                    var openId = $(this).parent().siblings(':first').html();
                    $.ajax({
                        type: "get",
                        url: "/proxy/getProxyNum",
                        contentType: "application/json; charset=utf-8",
                        data: {
                            'uid': openId
                        },
                        success: function(res) {
                            if(res.error_code == 0) {
                                $('.yyji').html(res.data.count1)
                                $('.eeji').html(res.data.count2)
                                $('.ssji').html(res.data.count3)
                            } else {
                                alert('该用户暂时没有团队详情！')
                            }
                        }
                    });
                })

                function download(openId, startPage) {
                    $.ajax({
                        type: "get",
                        url: "/proxy/getCashRecord",
                        contentType: "application/json; charset=utf-8",
                        data: {
                            'openId': openId,
                            'startPage': startPage
                        },
                        success: function(res) {
                            if(res.error_code == 0) {
                                for(var i = 0; i < res.data.value.length; i++) {
                                    var str = '';
                                    str += '<ul class="ziy">';
                                    str += '<li>' + ((res.data.inPage * 10 - 10) + i + 1) + '</li>';
                                    str += '<li>' + getLocalTime(res.data.value[i].createTime).substring(9, length) + '</li>';
                                    str += '<li>' + res.data.value[i].money.toFixed(2) + '</li>';
                                    if(res.data.value[i].status == 0) {
                                        str += '<li>' + '成功' + '</li>';
                                    } else {
                                        str += '<li>' + '失败' + '</li>';
                                    }
                                    $('.football-2').append(str)
                                }
                            } else {
                                alert('该用户暂时没有提现记录！！')
                            }

                        }
                    });
                }
                //提现记录
                var openId = '';
                $('tbody').on('click', '.xian', function() {
                    $('.football-2').children().remove('.ulas')
                    $('.football-2').show().siblings().hide()
                    $('.football-2 .nav-gta >h3').html($(this).html());
                    $('.cover').show();
                    openId = $(this).parent().siblings('.imss').children().attr('title');
                    download(openId, 1);
                })
                var i = 1;
                $('.lower').on('click', function(event) {
                    event.stopPropagation();
                    if($('.football-2').find('.ziy').length >= 10) {
                        $('.football-2').children().remove('.ziy')
                        i++;
                        download(openId, i);
                    }

                })

                $('.upper').on('click', function(event) {
                    event.stopPropagation();
                    if($('.football-2').find('.ziy').first().children().first().html() - 10 >= 1) {
                        i--;
                        $('.football-2').children().remove('.ziy')
                        download(openId, i);
                    }
                })
                //----------------------

                var openId = '';
                $('tbody').on('click', '.gao', function() {
                    $('.displays-2').children().remove('.guangao');
                    $('.football-3').show().siblings().hide()
                    $('.cover').show();
                    $('.football-1').show();
                    openId = $(this).parent().siblings('.imss').children().attr('title');
                    charset(openId, 1)
                });
                var m = 1;
                $('.toim').on('click', function(event) {
                    event.stopPropagation();
                    if($('.displays-1').find('.guangao').length >= 10) {
                        $('.displays-1').children().remove('.guangao');
                        m++;
                        charset(openId, m);
                    }
                })

                $('.toggles').on('click', function(event) {
                    event.stopPropagation();
                    if($('.displays-1').find('.guangao').first().children().first().html() - 10 >= 1) {
                        m--;
                        $('.displays-1').children().remove('.guangao');
                        charset(openId, m)
                    }
                })

                function charset(openId, startPage) {
                    $.ajax({
                        type: "get",
                        url: "/proxy/getRechargeRecordMoney",
                        contentType: "application/json; charset=utf-8",
                        data: {
                            'openId': openId,
                            'startPage': startPage
                        },
                        success: function(res) {
                            if(res.error_code == 0) {
                                var Advertise = 'Advertise';
                                var footBall = 'footBall';
                                //支出
                                for(var i = 0; i < res.data.value.length; i++) {
                                    var str = '';
                                    str += '<ul class="guangao">';
                                    str += '<li>' + ((res.data.inPage * 10 - 10) + i + 1) + '</li>';
                                    str += '<li>' + getLocalTime(res.data.value[i].rechargeTime).substring(9, length) + '</li>';
                                    str += '<li>' + res.data.value[i].money.toFixed(2) + '</li>';
                                    str += '<li>成功</li>';
                                    str += '</ul>';

                                    $('.displays-1').append(str)
                                }
                            } else {
                                alert('该用户暂时没有广告金记录！！')
                            }
                        }
                    });
                }

                $('.spend').on('click', function(event) {
                    $('.displays-2').children().remove('.guangao')
                    event.stopPropagation();
                    $('.displays-2').children().remove('.ulclass')
                    $('.displays-1').hide();
                    $('.displays-2').show();
                    manager(openId, 1);
                })

                var n = 1;
                $('.Last').on('click', function(event) {
                    event.stopPropagation();
                    if($('.displays-2').find('.guangao').length >= 10) {
                        $('.displays-2').children().remove('.guangao');
                        n++;
                        manager(openId, n);
                    }
                })

                $('.fost').on('click', function(event) {
                    event.stopPropagation();
                    if($('.displays-2').find('.guangao').first().children().first().html() - 10 >= 1) {
                        n--;
                        if(n !== 0) {
                            $('.displays-2').children().remove('.guangao');
                            manager(openId, n);
                        }
                    }

                })

                function manager(openId, startPage) {
                    $.ajax({
                        type: "get",
                        url: "/proxy/getExpendRecordMoney",
                        contentType: "application/json; charset=utf-8",
                        data: {
                            'openId': openId,
                            'startPage': startPage
                        },
                        success: function(res) {
                            console.log(res);
                            for(var i = 0; i < res.data.value.length; i++) {
                                str = '';
                                str += '<ul class="guangao">';
                                str += '<li>' + ((res.data.inPage * 10 - 10) + i + 1) + '</li>';
                                str += '<li>' + getLocalTime(res.data.value[i].expendTime).substring(9, length) + '</li>';
                                str += '<li>' + res.data.value[i].expendMoney.toFixed(2) + '</li>';
                                str += '<li>成功</li>';
                                str += '</ul>';

                                $('.displays-2').append(str)
                            }
                        }
                    });
                }

                //佣金纪录
                function advertisement(openId, startPage) {
                    $.ajax({
                        type: "get",
                        url: "/proxy/getCommRecord",
                        contentType: "application/json; charset=utf-8",
                        data: {
                            'openId': openId,
                            'startPage': startPage
                        },
                        success: function(res) {
                            if(res.error_code == 0) {
                                var commType = "advertClick";
                                var agencyComm = 'agencyComm';
                                for(var i = 0; i < res.data.value.length; i++) {
                                    var str = '';
                                    str += '<ul class="ziy">';
                                    str += '<li>' + ((res.data.inPage * 10 - 10) + i + 1) + '</li>';
                                    str += '<li>' + getLocalTime(res.data.value[i].commTime).substring(9, length) + '</li>';
                                    str += '<li>' + res.data.value[i].money.toFixed(2) + '</li>';
                                    if(res.data.value[i].commType == commType) {
                                        str += '<li>点击广告</li>';
                                    } else if(res.data.value[i].commType == agencyComm) {
                                        str += '<li>返佣</li>';
                                    }
                                    $('.football-3').append(str)
                                }
                            } else {
                                alert('该用户暂时没有佣金提现记录！')
                            }
                        }
                    });
                }

                var openId = '';
                $('tbody').on('click', '.yong', function() {
                    $('.football-3').children().remove('.ziy')
                    $('.football-3').show().siblings().hide()
                    $('.cover').show();
                    openId = $(this).parent().siblings('.imss').children().attr('title');
                    advertisement(openId, 1)
                })

                var a = 1;
                $('.goto').on('click', function(event) {
                    event.stopPropagation();
                    if($('.football-3').find('.ziy').length >= 10) {
                        $('.football-3').children().remove('.ziy')
                        a++;
                        advertisement(openId, a)
                    }
                })

                $('.come').on('click', function(event) {
                    event.stopPropagation();
                    if($('.football-3').find('.ziy').first().children().first().html() - 10 >= 1) {
                        $('.football-3').children().remove('.ziy')
                        a--;
                        advertisement(openId, a)
                    }

                })
            }
        });

        $('.cover').on('click', function() {
            $('.cover').hide();
            $('.football').children().remove('.ziy')
            $('.football').children().remove('.yiji')
            $('.football').children().remove('.yingc1')
            $('.football').children().remove('.topnav')
            $('.football-2').children().remove('.ziy')

            $('.displays-1').children().remove('.guangao')
            $('.displays-2').children().remove('.guangao')
        })

        $('.but-input').on('click', function() {
            var input_val = $('.query-input').val();
            if(input_val.length !== 0) {
                $('.Tbody').children('tr').remove();
                $.ajax({
                    type: "get",
                    url: "/proxy/checkUserById",
                    contentType: "application/json; charset=utf-8",
                    data: {
                        'uid': input_val
                    },
                    success: function(res) {
                        console.log(res)
                        if(res.data.id == input_val) {
                            var str = '';
                            str += '<tr>';
                            str += '<td>' + res.data.id + '</td>';
                            str += '<td>' + res.data.nickName + '</td>';
                            str += '<td class="imss"><img src="' + res.data.headImgUrl + '"  title="' + res.data.openid + '"/></td>';
                            str += '<td>' + res.data.parentId + '</td>';
                            str += '<td>' + res.data.agentName + '</td>';
                            str += '<td>' + res.data.money.toFixed(2) + '</td>';
                            str += '<td>' + res.data.commMoney.toFixed(2) + '</td>';
                            str += '<td>' + res.data.giftAdvertMoney.toFixed(2) + '</td>';
                            str += '<td>' + getLocalTime(res.data.createTime).substring(9, length) + '</td>';
                            str += '<td><a href="#" class="ti">踢球明细</a> &ensp; <a href="#" class="tuan">团队详情</a> &ensp; <a href="#" class="xian">提现详情</a> &ensp; <a href="#" class="gao">广告金记录</a> &ensp; <a href="#" class="yong">佣金明细</a></td>';
                            str += '</tr>';

                            $('.Tbody').append(str)
                            $('.post').siblings().hide();
                        } else if(res.data.id == null) {
                            alert(res.id)
                        }
                        $(".tcdPageCode").createPage({
                            pageCount: 1,
                            current: 1,
                            backFn: function(p) {
                                startPage = p;
                            }
                        });
                    }
                });

            }
        })

        $('.Page').on('click', function(event) {
            event.stopPropagation();
        })

        $('.record').on('click', function() {
            $(this).css('background', 'lightgrey').siblings().css('background', '#eee')
        })

        $('.recharge').on('click', function(event) {
            event.stopPropagation();
            $('.displays-1').show();
            $('.displays-2').hide();
        })
        $('.nextPage').on('click', function(event) {
            return false;
        })
    })
>>>>>>> 1d0dbbfbefb9363078b5db6b25b893ccb128c207
})